import { GButton } from "../../../../../com/mui/controls/GButton";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { Language } from "../../../../../extend/language/Language";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { ToolTipInfo } from "../../../model/ToolTipInfo";
import { NormalTooltip } from "../tooltip/NormalTooltip";
//class RepairAllEquipButton
    
    export  class RepairAllEquipButton extends GButton
    {
        constructor()
        {
            super();
            this.styleName = "Button";
            this.textField.filters = [FilterConst.glowFilter];
            this.label = Language.getString(40080);
            this.addEventListener(flash.events.MouseEvent.ROLL_OVER, this.onGetToolTipData);
            return;
        }

        /* internal  */onGetToolTipData(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.RepairAllWeaponCost));
            Dispatcher.addEventListener(EventName.RepairAllWeaponCostSuccess, this.onGetCostSuccess);
            return;
        }

        /* internal  */onGetCostSuccess(arg1: DataEvent): void
        {
            Dispatcher.removeEventListener(EventName.RepairAllWeaponCostSuccess, this.onGetCostSuccess);
            this.toolTipData = arg1.data;
            return;
        }

        public /* override */ set toolTipData(arg1)
        {
            if (_toolTipData) 
            {
                (_toolTipData as ToolTipInfo).tooltipData = arg1;
            }
            else 
            {
                _toolTipData = new ToolTipInfo(NormalTooltip.ToolTipRenderType_RepairCost, arg1);
            }
            return;
        }

        public /* override */ dispose(arg1: Boolean=true): void
        {
            super.dispose();
            this.textField.filters = [FilterConst.glowFilter];
            this.label = Language.getString(40080);
            return;
        }
    }
